<template>
	<view class="container page">
		<Header :isBack="true">
			<block slot="content">{{title}}</block>
		</Header>
		<view class="" style="padding:10rpx 20rpx;">
			<rich-text :nodes="info.content"></rich-text>
			<view class="operator"
				style="display: flex;justify-content: space-between;padding-top:30upx;padding-bottom: 20upx;">
				<view class="agree" @tap="goAgree">
					我已知晓并同意
				</view>
				<view class="refuse" @tap="goRefuse">
					拒绝
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				title: '隐私政策',
				info: {}
			};
		},
		onLoad(option) {
			this.loadData();
		},
		methods: {
			async loadData() {
				let res = await this.$myRequest({
					url: '/getAgreement'
				})

				this.info = res.data.data;
			},
			
			goAgree() {
				uni.navigateTo({
					url: '/pages/login/login'
				})
			},

			goRefuse() {
				//退出app
				// #ifdef APP-PLUS
				if (plus.os.name.toLowerCase() === 'android') {
					plus.runtime.quit();
				} else {
					const threadClass = plus.ios.importClass("NSThread");
					const mainThread = plus.ios.invoke(threadClass, "mainThread");
					plus.ios.invoke(mainThread, "exit");
				}
				// #endif
			}
		}
	}
</script>
<style>
	page {
		background-color: #f7f7f7;
		font-size: $uni-font-size-base;
	}
</style>
<style lang='scss'>
	.container {
		// #ifdef APP-PLUS
		padding-top: 160rpx;
		// #endif

		// #ifdef H5
		padding-top: 100rpx;
		// #endif

		// #ifdef MP-WEIXIN
		padding-top: 165rpx;
		// #endif
	}

	.text {
		font-size: 28upx;
		margin-top: 14upx;
		color: #333;
		text-align: justify;
	}

	.agree,
	.refuse {
		width: 45%;
		background-color: $uni-text-color;
		color: #fff;
		height: 40px;
		line-height: 40px;
		border-radius: 10upx;
		text-align: center;
		font-size: $uni-font-size-base;
		letter-spacing: 2upx;
	}

	.refuse {
		background-color: #909399;
	}
</style>